package club.msecret.mblog.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import tk.mybatis.mapper.annotation.KeySql;
import javax.persistence.*;;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @Description  
 * @Author  
 * @Date 2020-11-09 
 */

@Entity
@Data
@Table ( name ="article" )
public class Article implements Serializable {

	private static final long serialVersionUID =  1L;

    @Id
    @KeySql(useGeneratedKeys = true)
   	@Column(name = "id" )
	private Long id;

   	@Column(name = "articleId" )
	private Long articleId;

   	@Column(name = "author" )
	private String author;

   	@Column(name = "articleTitle" )
	private String articleTitle;

   	@Column(name = "outline" )
	private String outline;

   	@Column(name = "articleContent" )
	private String articleContent;

//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
   	@Column(name = "publishTime" )
	private Date publishTime;

//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
   	@Column(name = "lastEditTime" )
	private Date lastEditTime;

	@Column(name = "status" )
	private Integer status;

   	@Transient
   	private List<Tag> tags;

   	@Transient
	private String cName;

	public List<Tag> getTags() {
		return tags;
	}

	public String getcName() {
		return cName;
	}
}
